package tms.controler;

import tms.Cache;
import tms.service.ServiceHandler;

public class LoginController {

    /**
     * Log in with given email and password, if success logged user is store in Cache.CURRENT_USER.
     * @param email
     * @param password
     * @return true if success otherwise fail
     */
    public boolean logIn(String email, String password){

        Cache.setCurrentUser(ServiceHandler.getFirstAccount("Email = '" + email +
                "' AND Password = '" + password + "'"));

        return Cache.currentUser != null;
    }
}
